package com.hgw.Demo05_MediatorPattern.MediatorPattern;

/**
 * Data time:2021/12/18 17:09
 * StudentID:2019112118
 * Author:hgw
 * Description: 抽象同事类
 */
public abstract class Colleague {
    protected Mediator mediator;        // 维持一个抽象中介者的引用

    public Colleague(Mediator mediator) {
        this.mediator = mediator;
    }

    public abstract void method1();     // 声明自身方法，处理自己的行为

    // 定义依赖方法，与中介者进行通信
    public void method2() {
        mediator.operation();
    }
}
